//返回ID对象
var g = function(id){
	return document.getElementById(id);
}

//为字符串增加trim方法，使用正则表达式截取空格
String.prototype.trim = function(){							
	return this.replace(/^\s*/,"").replace(/\s*$/,"");
}

//验证的ID
var srname = g("srname");
var sdname = g("sdname");
var ctname = g("ctname");

//错误提示
var ctnamemsg = g("ctnamemsg");
var sdnamemsg = g("sdnamemsg");
var srnamemsg = g("srnamemsg");

//角色验证
function srnameCheck(){
	if(srname.value.trim() == "" || srname.value == null){
		srname.style.border = "1px solid";
		srname.style.borderColor = "red";
		srnamemsg.innerHTML = "<font color='red' size='1px'>请填写角色名称！</font>";
		return false;
	}else{
		srname.style.border = "";
		srname.style.borderColor = "";
		srnamemsg.innerHTML = "";
		return true;
	}
}

//案件类型验证
function ctnameCheck(){
	if(ctname.value.trim() == "" || ctname.value == null){
		ctname.style.border = "1px solid";
		ctname.style.borderColor = "red";
		ctnamemsg.innerHTML = "<font color='red' size='1px'>请填写案件类型名称！</font>";
		return false;
	}else{
		ctname.style.border = "";
		ctname.style.borderColor = "";
		ctnamemsg.innerHTML = "";
		return true;
	}
}

//部门验证
function sdnameCheck(){
	if(sdname.value.trim() == "" || sdname.value == null){
		sdname.style.border = "1px solid";
		sdname.style.borderColor = "red";
		sdnamemsg.innerHTML = "<font color='red' size='1px'>请填写部门名称！</font>";
		return false;
	}else{
		sdname.style.border = "";
		sdname.style.borderColor = "";
		sdnamemsg.innerHTML = "";
		return true;
	}
}